﻿using System;
using System.Collections.Generic;
using System.Text;
using Server;
using Scripts.Scripts.Items.Special.Custom;
using Server.Gumps;

namespace Scripts.Scripts.Items.Special.Custom
{
    public class Novella : Item
    {
        private string m_BaseName = "a novella";
        public bool GumpOpen = false;

        [Constructable]
        public Novella()
            :base(0x42BF)
        {
            this.Name = m_BaseName;
        }
        public Novella(Serial serial)
            : base(serial)
        {

        }

        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                return;
            }
            if (!GumpOpen)
            {
                from.SendGump(new NovellaGump(from, this));
                GumpOpen = true;
            }
            else { from.SendMessage("You're already reading the novella."); }
        }
        public override void Serialize(GenericWriter writer)
        {

            base.Serialize(writer);

            writer.Write((int)0); // version

        }


        public override void Deserialize(GenericReader reader)
        {

            base.Deserialize(reader);

            int version = reader.ReadInt();

        }
    }
}
namespace Server.Gumps
{

    public class NovellaGump : Gump
    {
        private Novella m_nov;

        public NovellaGump(Mobile from, Novella nov)
            : base(20, 30)
        {
            m_nov = nov;

            AddPage(0);

            AddBackground(0, 0, 260, 351, 5054);
            AddImageTiled(11, 11, 238, 21, 0xBBC);

            AddLabel(65, 11, 0, "Page uno");

            AddPage(1);

        }
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;
            if ((from == null) || (m_nov.Deleted))

                return;

            m_nov.GumpOpen = false;

        }
    }
}